/*------------------------------------------------------------------------------

	T.6: Probability to win the SNED in the next round 

*/
 
global replica_dir="<add path to your working directory>"
global data_dir=	"$replica_dir/data"
global output_dir=	"$replica_dir/output"

use "$data_dir/slvl_fin.dta", clear 



global indepvars  "i.sned_yr i.hg "


eststo clear

eststo:reg win_next    treat25 st_ind25 st_ind25_sq inter25 inter25_sq  ${indepvars}  , vce(cluster rbd)
eststo:reg win_next    treat10 st_ind10 st_ind10_sq inter10 inter10_sq  ${indepvars}  , vce(cluster rbd)

eststo:reg win_next    treat25 st_ind25 st_ind25_sq inter25 inter25_sq  ${indepvars} if abs(st_ind25) <= 1.5, vce(cluster rbd)
eststo:reg win_next    treat10 st_ind10 st_ind10_sq inter10 inter10_sq  ${indepvars} if abs(st_ind10) <= 1.5, vce(cluster rbd)

eststo:reg win_next25  treat25 st_ind25 st_ind25_sq inter25 inter25_sq  ${indepvars} if abs(st_ind25) <= 1.5, vce(cluster rbd)
eststo:reg win_next25  treat10 st_ind10 st_ind10_sq inter10 inter10_sq  ${indepvars} if abs(st_ind10) <= 1.5, vce(cluster rbd)

eststo:reg win_next10  treat25 st_ind25 st_ind25_sq inter25 inter25_sq  ${indepvars} if abs(st_ind25) <= 1.5, vce(cluster rbd)	
eststo:reg win_next10  treat10 st_ind10 st_ind10_sq inter10 inter10_sq  ${indepvars} if abs(st_ind10) <= 1.5, vce(cluster rbd)	
 	
esttab  using "$output_dir/post_s_winagain.tex", tex nolines fragment label replace  collabels(none) nomtitles nonumbers star(* 0.10 ** 0.05 *** 0.01) ///
cells(b(star fmt(3)) se(par(( )) fmt(3))) ///
keep(treat25 treat10) ///
stats(N r2, fmt(0 3)  ///
labels(`"Observations"' `"R-squared"' ))

/* 
	Mean of dependent variable 
*/
sum win_next if treat25!=.
sum win_next if treat10!=.	
sum win_next win_next25 win_next10 if treat25!=. & abs(st_ind25) <= 1.5
sum win_next win_next25 win_next10 if treat10!=. & abs(st_ind10) <= 1.5




	
	
